package com.live.dengdengtv.utils;

public class ViewClickUtils {

	private static int defaultDelayMillis = 800;

	public static int getDefaultDelayMillis() {
		return defaultDelayMillis;
	}

	public static void setDefaultDelayMillis(int defaultDelayMillis) {
		ViewClickUtils.defaultDelayMillis = defaultDelayMillis;
	}

	private static long lastClickTime;

	public static boolean isFastClick() {

		return isFastClick(defaultDelayMillis);
	}

	/**
	 * 禁止连续点击,禁止同时多个view
	 * @param delayMillis	间隔时间
	 * @return
	 */
	public static boolean isFastClick(int delayMillis) {

		long time = System.currentTimeMillis();

		if (time - lastClickTime < delayMillis) {
			return true;
		}

		lastClickTime = time;

		return false;
	}

}
